#include "iap.h"

pFunction   Jump_To_Application;
static uint32_t g_JumpAddr = 0;



void JumpTo(uint32_t addr)
{
	if (((*(__IO uint32_t*)addr) & 0x2FFFC000) == 0x20000000)
	{
		 __set_PRIMASK(1);
		g_JumpAddr = *(__IO uint32_t*)(addr + 4);
		Jump_To_Application = (pFunction)g_JumpAddr;
		
		SysTick->CTRL       = 0;
    SysTick->LOAD       = 0;
    SysTick->VAL        = 0;

    SCB->VTOR           = addr;
		
		
		__ISB();
		/* Initialize user application's Stack Pointer */
		__set_MSP(*(__IO uint32_t*)addr);
		Jump_To_Application();
	}
}







